#ifndef GUI_SELECT_H
#define GUI_SELECT_H

    #define GUI_SELECT_ITEM_NUM 5
    #define GUI_SELECT_ITEM_TEXT_LEN 8
    #define GUI_SELECT_ITEM_BTN_W 10
    #define GUI_SELECT_ITEM_BTN_H 10
    #define GUI_SELECT_LABEL_W (GUI_SELECT_ITEM_TEXT_LEN*gui_text_char_width()+2)
    #define GUI_SELECT_LABEL_H (gui_text_char_height()+4)
    #define GUI_SELECT_ITEM_WIDTH (GUI_SELECT_ITEM_BTN_W+2+GUI_SELECT_LABEL_W+2)
    #define GUI_SELECT_ITEM_HEIGHT (GUI_SELECT_LABEL_H+2)
    

    #define GUI_SELECT_TYPE_SINGLE 0 //single select
    #define GUI_SELECT_TYPE_MULTIPLE 1 //multiple select

    typedef struct 
    {
        gui_spirit_t spirit;
        int type;
        list_t button_list; //all switch button list
        gui_button_t *buttons[GUI_SELECT_ITEM_NUM]; 
        gui_spirit_t *labels[GUI_SELECT_ITEM_NUM];
        uint8_t select_status; //cur select status 
        uint8_t select_nums; 
    }gui_select_t;

    #define GUI_SELECT(spirit) ((gui_select_t*)(spirit))


    int8_t gui_select_button_idx(gui_select_t *select,gui_button_t *button);
    gui_button_t *gui_select_idx_to_button(gui_select_t *select,uint8_t idx);
    void gui_select_choose(gui_select_t *select,gui_button_t *button,uint8_t is_choose);
    void gui_select_show(gui_spirit_t *select);
    void gui_select_set_multi(gui_select_t *select,int is_mul);
    gui_spirit_t *gui_select_create();
    void gui_select_label_set_text(gui_select_t *select,uint8_t label_idx,char *text);
    gui_spirit_t* gui_select_idx_to_label(gui_select_t *select,uint8_t idx);
    uint32_t gui_select_get_selects(gui_select_t *select);
    uint32_t gui_select_get_select_num(gui_select_t *select);


#endif 
